package com.hans.grpcserver.grpc;

import com.gitee.kamismile.stone.rpc.common.support.StoneURL;
import com.gitee.kamismile.stone.rpc.common.support.StoneRpcEnum;
import java.util.concurrent.TimeUnit;


import static com.hans.grpcserver.grpc.GreeterGrpc.getServiceDescriptor;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

@jakarta.annotation.Generated(
value = "by StoneGrpc generator",
comments = "Source: hello.proto")
public final class StoneGreeterGrpc {
private StoneGreeterGrpc() {}

public static class StoneGreeterStub implements Greeter {

protected StoneURL url;

protected GreeterGrpc.GreeterBlockingStub blockingStub;
protected GreeterGrpc.GreeterFutureStub futureStub;
protected GreeterGrpc.GreeterStub stub;

public StoneGreeterStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions, StoneURL url) {
    this.url = url;
    blockingStub = GreeterGrpc.newBlockingStub(channel).build(channel, callOptions);
    futureStub = GreeterGrpc.newFutureStub(channel).build(channel, callOptions);
    stub = GreeterGrpc.newStub(channel).build(channel, callOptions);
}

    public com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO sayHello(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
        return blockingStub
        .withDeadlineAfter(url.getParameter("timeout",StoneRpcEnum.TIMEOUT.getCode()), TimeUnit.MILLISECONDS)
        .sayHello(request);
    }

    public com.google.common.util.concurrent.ListenableFuture<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> sayHelloAsync(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
        return futureStub
        .withDeadlineAfter(url.getParameter("timeout",StoneRpcEnum.TIMEOUT.getCode()), TimeUnit.MILLISECONDS)
        .sayHello(request);
    }

    public void sayHello(com.hans.grpcserver.grpc.HelloProto.HelloRequest request, io.grpc.stub.StreamObserver<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> responseObserver){
     stub
     .withDeadlineAfter(url.getParameter("timeout",StoneRpcEnum.TIMEOUT.getCode()), TimeUnit.MILLISECONDS)
     .sayHello(request, responseObserver);
    }

    public com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO sayBye(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
        return blockingStub
        .withDeadlineAfter(url.getParameter("timeout",StoneRpcEnum.TIMEOUT.getCode()), TimeUnit.MILLISECONDS)
        .sayBye(request);
    }

    public com.google.common.util.concurrent.ListenableFuture<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> sayByeAsync(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
        return futureStub
        .withDeadlineAfter(url.getParameter("timeout",StoneRpcEnum.TIMEOUT.getCode()), TimeUnit.MILLISECONDS)
        .sayBye(request);
    }

    public void sayBye(com.hans.grpcserver.grpc.HelloProto.HelloRequest request, io.grpc.stub.StreamObserver<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> responseObserver){
     stub
     .withDeadlineAfter(url.getParameter("timeout",StoneRpcEnum.TIMEOUT.getCode()), TimeUnit.MILLISECONDS)
     .sayBye(request, responseObserver);
    }

}

public static StoneGreeterStub getStoneStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions, StoneURL url) {
    return new StoneGreeterStub(channel, callOptions, url);
}

public interface Greeter {
    default public com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO sayHello(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
     throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
    }

    default public com.google.common.util.concurrent.ListenableFuture<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> sayHelloAsync(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
      throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
    }

    public void sayHello(com.hans.grpcserver.grpc.HelloProto.HelloRequest request, io.grpc.stub.StreamObserver<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> responseObserver);

    default public com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO sayBye(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
     throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
    }

    default public com.google.common.util.concurrent.ListenableFuture<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> sayByeAsync(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
      throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
    }

    public void sayBye(com.hans.grpcserver.grpc.HelloProto.HelloRequest request, io.grpc.stub.StreamObserver<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> responseObserver);

}

public static abstract class GreeterImplBase implements io.grpc.BindableService, Greeter {

private Greeter proxiedImpl;

public final void setProxiedImpl(Greeter proxiedImpl) {
this.proxiedImpl = proxiedImpl;
}

    @java.lang.Override
    public final com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO sayHello(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
    throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
    }

    @java.lang.Override
    public final com.google.common.util.concurrent.ListenableFuture<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> sayHelloAsync(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
    throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
    }

    @java.lang.Override
    public final com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO sayBye(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
    throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
    }

    @java.lang.Override
    public final com.google.common.util.concurrent.ListenableFuture<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> sayByeAsync(com.hans.grpcserver.grpc.HelloProto.HelloRequest request) {
    throw new UnsupportedOperationException("No need to override this method, extend XxxImplBase and override all methods it allows.");
    }

        public void sayHello(com.hans.grpcserver.grpc.HelloProto.HelloRequest request,
        io.grpc.stub.StreamObserver<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> responseObserver) {
        asyncUnimplementedUnaryCall(com.hans.grpcserver.grpc.GreeterGrpc.getSayHelloMethod(), responseObserver);
        }
        public void sayBye(com.hans.grpcserver.grpc.HelloProto.HelloRequest request,
        io.grpc.stub.StreamObserver<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO> responseObserver) {
        asyncUnimplementedUnaryCall(com.hans.grpcserver.grpc.GreeterGrpc.getSayByeMethod(), responseObserver);
        }

@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
    .addMethod(
    com.hans.grpcserver.grpc.GreeterGrpc.getSayHelloMethod(),
    asyncUnaryCall(
    new MethodHandlers<
    com.hans.grpcserver.grpc.HelloProto.HelloRequest,
    com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO>(
    proxiedImpl, METHODID_SAY_HELLO)))
    .addMethod(
    com.hans.grpcserver.grpc.GreeterGrpc.getSayByeMethod(),
    asyncUnaryCall(
    new MethodHandlers<
    com.hans.grpcserver.grpc.HelloProto.HelloRequest,
    com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO>(
    proxiedImpl, METHODID_SAY_BYE)))
.build();
}
}
    private static final int METHODID_SAY_HELLO = 0;
    private static final int METHODID_SAY_BYE = 1;

private static final class MethodHandlers
<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod
<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod
<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod
<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod
<Req, Resp> {
private final Greeter serviceImpl;
private final int methodId;

MethodHandlers(Greeter serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}

@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver
<Resp> responseObserver) {
    switch (methodId) {
            case METHODID_SAY_HELLO:
            serviceImpl.sayHello((com.hans.grpcserver.grpc.HelloProto.HelloRequest) request,
            (io.grpc.stub.StreamObserver<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO>) responseObserver);
            break;
            case METHODID_SAY_BYE:
            serviceImpl.sayBye((com.hans.grpcserver.grpc.HelloProto.HelloRequest) request,
            (io.grpc.stub.StreamObserver<com.gitee.kamismile.stone.rpc.grpc.common.GrpcCommonProto.ResultDTO>) responseObserver);
            break;
    default:
    throw new java.lang.AssertionError();
    }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver
    <Req> invoke(io.grpc.stub.StreamObserver
        <Resp> responseObserver) {
            switch (methodId) {
            default:
            throw new java.lang.AssertionError();
            }
      }
   }

}